// 变更项目状态

<template>
    <f7-page class="change">
        <f7-navbar>
            <f7-nav-left>
                <f7-link back
                         icon-material="arrow_back"></f7-link>
            </f7-nav-left>
            <f7-nav-title>变更项目状态</f7-nav-title>
            <f7-nav-right>
                <f7-icon f7="house"
                         @click.native="fnToHome()"></f7-icon>
            </f7-nav-right>
        </f7-navbar>

        <van-notice-bar background="#fff"
                        color="#345">
            <f7-icon solt="left-icon"
                     color="#3385ff"
                     f7="layers_alt_fill"></f7-icon>
            <span>{{controlData.engineeInfo.engineeName}}</span>
        </van-notice-bar>

        <f7-list media-list>
            <f7-list-item>
                <div class="list-item-content">
                    <label>质量项目状态</label>
                    <span>
                        <v-picker-div placeholder="请选择"
                                      :defCheck="models.model.qualityOpenStatus"
                                      :columns="controlData.openStatusEnums"
                                      :assignment="models.model"
                                      code="qualityOpenStatus"
                                      name="qualityOpenStatusName">
                        </v-picker-div>
                    </span>
                </div>
            </f7-list-item>

            <f7-list-item>
                <div class="list-item-content">
                    <label>安全项目状态</label>
                    <span>
                        <v-picker-div placeholder="请选择"
                                      :defCheck="models.model.safeOpenStatus"
                                      :columns="controlData.openStatusEnums"
                                      :assignment="models.model"
                                      code="safeOpenStatus"
                                      name="safeOpenStatusName">
                        </v-picker-div>
                    </span>
                </div>
            </f7-list-item>
        </f7-list>

        <f7-list media-list>
            <f7-list-item>
                <div class="list-item-content">
                    <label>文件依据</label>
                </div>
                <qm-file-upload ref="status"
                                :galleryOptions="{ multiple: true, maximum: 9 }"
                                :params="{type:'attach', dataKey: models.model.caseId, bizType: 'status'}"></qm-file-upload>
            </f7-list-item>
        </f7-list>

        <f7-toolbar position="bottom"
                    v-has="'project:status:save'"
                    no-shadow
                    class="fff">
            <f7-button fill
                       class="submit-btn"
                       @click="fnSubmit()">提交</f7-button>
        </f7-toolbar>
    </f7-page>
</template>

<script>
import controller from "@/libs/framework/workflowController"

export default class instance extends controller {
    onInit () {
        this.urls = {
            model: "/project/status/getWorkflowViewModel",
            save: "/project/status/processSave"
        }
    }
    onBeforeSave (postModel) {
        console.log(postModel)
        return true
    }
    mixin () {
        return {
            data () {
                return {
                    controlData: {
                        // 项目状态枚举
                        openStatusEnums: [],
                        // 项目信息
                        engineeInfo: {}
                    },
                    models: {
                        model: {}
                    },
                    selectUser: {
                        selectComment: null,
                        comment: null,
                        comments: [],
                        tran: [],
                        activity: "",
                        users: [],
                    },
                }
            },
            methods: {
                // 提交
                fnSubmit () {
                    if (!this.models.model.qualityOpenStatus) {
                        this.$toast("请选择质量项目状态")
                        return false
                    }

                    if (!this.models.model.safeOpenStatus) {
                        this.$toast("请选择安全项目状态")
                        return false
                    }

                    if (this.$refs.status.getUploadedCount() < 1) {
                        this.$toast("请上传文件依据")
                        return false
                    }

                    this.send()
                }
            }
        }
    }
}
</script>

<style lang="less" scoped>
@deep: ~">>>";

.change {
    .submit-btn {
        flex: 1;
        margin: 0 10px;
    }

    .list {
        margin: 10px 0;

        @{deep}.pic_upload {
            padding: 0;
        }
    }

    .list-item-content {
        display: flex;
        font-size: 14px;
        justify-content: space-between;

        > label {
            width: 38%;
            line-height: 18px;
            padding: 10px 0;
        }
    }
}
</style>
